package com.lb.trac.pojo.condition.order;

import org.apache.commons.lang.StringUtils;
import org.hibernate.Criteria;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Property;

import com.lb.trac.pojo.Utenti;
import com.lb.trac.pojo.comparator.OrderBy;

public class FindSocietaOrderByDescrizione implements OrderCondition {

	private int type;

	public FindSocietaOrderByDescrizione(int type) {
		setType(type);
	}
	public FindSocietaOrderByDescrizione() {
	}

	@Override
	public Object create(Object... objects) {
		Criteria criteria = (Criteria) objects[0];
		return type==OrderBy.DESC?criteria.addOrder(Order.desc("descrizione")):criteria.addOrder(Order.asc("descrizione"));
	}

	@Override
	public void setType(int type) {
		this.type = type;
		
	}

}
